abstract class Factory {
    abstract createProductA(): ProductA;
    abstract createProductB(): ProductB;
}

abstract class ProductA {
    abstract operate(): void;
}

abstract class ProductB {
    abstract operate(): void;
}

class DarkFactory extends Factory {
    createProductA(): ProductA {
        return new DarkProductA();
    }
    createProductB(): ProductB {
        return new DarkProductB();
    }
}

class DarkProductA extends ProductA {
    operate() {
        console.log('黑暗模式的产品A');
    }
}

class DarkProductB extends ProductB {
    operate() {
        console.log('黑暗模式的产品B');
    }
}

const factory : Factory = new DarkFactory();
factory.createProductA().operate();
factory.createProductB().operate();
